home *** CD-ROM | disk | FTP | other *** search
/ Champak 145 / (Vol 145) Dec 21 2011.iso / Games / kazooball.swf / scripts / __Packages / com / tmgc / gameconnector / GameConnectorAS2.as
Encoding:
Text File  |  2011-12-21  |  2.3 KB  |  76 lines

  1. class com.tmgc.gameconnector.GameConnectorAS2 extends MovieClip
  2. {
  3.    var _localConnection;
  4.    var _doofConnectionName = "doof";
  5.    var _gameConnectionName = "game";
  6.    function GameConnectorAS2()
  7.    {
  8.       super();
  9.       var _loc7_ = unescape(this._url);
  10.       var _loc9_ = _loc7_.lastIndexOf("?");
  11.       var _loc8_ = _loc7_.substr(_loc9_ + 1,_loc7_.length);
  12.       var _loc6_ = _loc8_.split("&");
  13.       var _loc3_ = 0;
  14.       while(_loc3_ < _loc6_.length)
  15.       {
  16.          var _loc5_ = _loc6_[_loc3_].split("=")[0];
  17.          var _loc4_ = _loc6_[_loc3_].split("=")[1];
  18.          if(_loc5_ == "doofConnectionName")
  19.          {
  20.             this._doofConnectionName = _loc4_;
  21.          }
  22.          if(_loc5_ == "gameConnectionName")
  23.          {
  24.             this._gameConnectionName = _loc4_;
  25.          }
  26.          _loc3_ = _loc3_ + 1;
  27.       }
  28.       this._localConnection = new LocalConnection();
  29.       try
  30.       {
  31.          this._localConnection.connect(this.gameConnectionName);
  32.       }
  33.       catch(error:Error)
  34.       {
  35.          trace(error);
  36.       }
  37.    }
  38.    function get doofConnectionName()
  39.    {
  40.       return this._doofConnectionName;
  41.    }
  42.    function get gameConnectionName()
  43.    {
  44.       return this._gameConnectionName;
  45.    }
  46.    function gameStarted(initialScore)
  47.    {
  48.       trace("GameConnectorAS2.gameStarted() initialScore=" + String(initialScore));
  49.       this._localConnection.send(this.doofConnectionName,"gameStarted",initialScore);
  50.    }
  51.    function gameEnded(finalScore)
  52.    {
  53.       trace("GameConnectorAS2.gameEnded() finalScore=" + String(finalScore));
  54.       this._localConnection.send(this.doofConnectionName,"gameEnded",finalScore);
  55.    }
  56.    function gameScore(score)
  57.    {
  58.       trace("GameConnectorAS2.gameScore() score=" + String(score));
  59.       this._localConnection.send(this.doofConnectionName,"gameScore",score);
  60.    }
  61.    function gameStat(statName, statValue)
  62.    {
  63.       trace("GameConnectorAS2.gameStat() statName=" + statName + ", statValue=" + statValue);
  64.       this._localConnection.send(this.doofConnectionName,"gameStat",statName,statValue);
  65.    }
  66.    function gameStatList(stats)
  67.    {
  68.       trace("GameConnectorAS2.gameStatList() stats=" + stats);
  69.       this._localConnection.send(this.doofConnectionName,"gameStatList",stats);
  70.    }
  71.    function stopGame()
  72.    {
  73.       trace("GameConnectorAS2.stopGame()");
  74.    }
  75. }
  76.